﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MindFactorial.LaunchPoint.Console
{
    /// <summary>
    /// Interaction logic for LaunchPad.xaml
    /// </summary>
    public partial class LaunchPad
    {
        ConsoleWindow _window = null;
        public LaunchPad(ConsoleWindow window)
        {
            InitializeComponent();
            _window = window;
            this.Loaded += new RoutedEventHandler(LaunchPad_Loaded);
        }

        void LaunchPad_Loaded(object sender2, RoutedEventArgs e2)
        {
            _window.WindowTitle = "Dashboard";

            //add default icons
            Image img_home = new Image();
            img_home.Source = new BitmapImage(new Uri("../media/images/launchpad_images/home.png", UriKind.RelativeOrAbsolute));
            img_home.Stretch = Stretch.UniformToFill;
            img_home.StretchDirection = StretchDirection.Both;
            img_home.Cursor = Cursors.Hand;
            img_home.Tag = "Home";
            img_home.MouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs e)
            {
                _window.NavigateToFirstPlugin();
            };
            img_home.Margin = new Thickness(2);
            ctrl_panel.ChildElements.Add(img_home);

            
            //security
            Image img_security = new Image();
            img_security.Source = new BitmapImage(new Uri("../media/images/launchpad_images/security.png", UriKind.RelativeOrAbsolute));
            img_security.Stretch = Stretch.UniformToFill;
            img_security.StretchDirection = StretchDirection.Both;
            img_security.Cursor = Cursors.Hand;
            img_security.MouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs e)
            {
                _window.NavigateToPlugin("Security Manager");
            };
            img_security.Margin = new Thickness(2);
            ctrl_panel.ChildElements.Add(img_security);

            //settings
            Image img_settings = new Image();
            img_settings.Source = new BitmapImage(new Uri("../media/images/launchpad_images/configuration.png", UriKind.RelativeOrAbsolute));
            img_settings.Stretch = Stretch.UniformToFill;
            img_settings.StretchDirection = StretchDirection.Both;
            img_settings.Cursor = Cursors.Hand;
            img_settings.MouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs e)
            {
                _window.NavigateToPlugin("General Settings");
            };
            img_settings.Margin = new Thickness(2);
            ctrl_panel.ChildElements.Add(img_settings);

            //web
            Image img_web = new Image();
            img_web.Source = new BitmapImage(new Uri("../media/images/launchpad_images/web.png", UriKind.RelativeOrAbsolute));
            img_web.Stretch = Stretch.UniformToFill;
            img_web.StretchDirection = StretchDirection.Both;
            img_web.Cursor = Cursors.Hand;
            img_web.Margin = new Thickness(2);
            ctrl_panel.ChildElements.Add(img_web);


            //user admin
            Image img_useradmin = new Image();
            img_useradmin.Source = new BitmapImage(new Uri("../media/images/launchpad_images/useradmin.png", UriKind.RelativeOrAbsolute));
            img_useradmin.Stretch = Stretch.UniformToFill;
            img_useradmin.StretchDirection = StretchDirection.Both;
            img_useradmin.Cursor = Cursors.Hand;
            img_useradmin.Margin = new Thickness(2);
            ctrl_panel.ChildElements.Add(img_useradmin);

            
            //cad macro
            Image img_cadmacro = new Image();
            img_cadmacro.Source = new BitmapImage(new Uri("../media/images/launchpad_images/cad_macro_editor.png", UriKind.Relative));
            img_cadmacro.Stretch = Stretch.UniformToFill;
            img_cadmacro.StretchDirection = StretchDirection.Both;
            img_cadmacro.Cursor = Cursors.Hand;
            img_cadmacro.MouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs e)
            {
                _window.NavigateToPlugin("Product Manager");
            };
            img_cadmacro.Margin = new Thickness(2);
            ctrl_panel.ChildElements.Add(img_cadmacro);

            //pcb editor
            Image img_pcbeditor = new Image();
            img_pcbeditor.Source = new BitmapImage(new Uri("../media/images/launchpad_images/editpcb.png", UriKind.Relative));
            img_pcbeditor.Stretch = Stretch.UniformToFill;
            img_pcbeditor.StretchDirection = StretchDirection.Both;
            img_pcbeditor.Cursor = Cursors.Hand;
            img_pcbeditor.MouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs e)
            {
                _window.NavigateToPlugin("Part Manager");
            };
            img_pcbeditor.Margin = new Thickness(2);
            ctrl_panel.ChildElements.Add(img_pcbeditor);

            //factory manager
            Image img_factorymanager = new Image();
            img_factorymanager.Source = new BitmapImage(new Uri("../media/images/launchpad_images/factory-manager.png", UriKind.Relative));
            img_factorymanager.Stretch = Stretch.UniformToFill;
            img_factorymanager.StretchDirection = StretchDirection.Both;
            img_factorymanager.Cursor = Cursors.Hand;
            img_factorymanager.MouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs e)
            {
                _window.NavigateToPlugin("Factory Manager");
            };
            img_factorymanager.Margin = new Thickness(2);
            ctrl_panel.ChildElements.Add(img_factorymanager);

            //project explorer
            Image img_projectexplorer = new Image();
            img_projectexplorer.Source = new BitmapImage(new Uri("../media/images/launchpad_images/project_explorer.png", UriKind.Relative));
            img_projectexplorer.Stretch = Stretch.UniformToFill;
            img_projectexplorer.StretchDirection = StretchDirection.Both;
            img_projectexplorer.Cursor = Cursors.Hand;
            img_projectexplorer.MouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs e)
            {
                _window.NavigateToPlugin("Project Manager");
            };
            img_projectexplorer.Margin = new Thickness(2);
            ctrl_panel.ChildElements.Add(img_projectexplorer);



        }

         

        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            _window.NavigateToFirstPlugin();
        }
    }
}
